package com.woniu.zsd.platform.consumer;

import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class DeleteRefreshTokenConsumer {
    @Resource
    private RedisTemplate<String, Object> redisObjectTemplate;
    @RabbitHandler
    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(name = "delete_refresh_token_queue"),
            exchange = @Exchange(name = "delay_exchange2",type = "direct"),
            key = "delete_refresh_token"
    ))
    public void delKey(String Key) throws Exception {
        redisObjectTemplate.delete(Key);
        System.out.println("Key" + Key);
    }
}
